package com.ybkj.daijia.server.service;

import com.ybkj.daijia.chart.TableOrderMonthVo;
import com.ybkj.daijia.common.CompanyOrderVo;
import com.ybkj.daijia.common.DriverOrderDetailVo;
import com.ybkj.daijia.common.DriverOrderVo;
import com.ybkj.daijia.common.MemberOrderVo;
import com.ybkj.daijia.common.OrderFromSourceVo;
import com.ybkj.daijia.common.PageVo;
import com.ybkj.daijia.common.Result;
import com.ybkj.daijia.page.Page;
import com.ybkj.daijia.server.freight.Order;
import com.ybkj.daijia.server.freight.OrderOrbit;
import com.ybkj.daijia.server.freight.PayRecordOrder;
import com.ybkj.daijia.server.freight.Truck;
import com.ybkj.daijia.server.freight.TruckType;
import com.ybkj.daijia.server.freight.TruckTypeCompany;
import com.ybkj.daijia.server.mc.Passenger;
import com.ybkj.daijia.server.model.ChartDay;
import com.ybkj.daijia.server.model.ChartMonth;
import com.ybkj.daijia.server.model.ChartYear;
import com.ybkj.daijia.server.model.Driver;
import com.ybkj.daijia.server.model.Rate;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface FreightService {

    Page<TruckType> queryTruckType(Long companyId);

    TruckType findByTruckTypeId(Long truckTypeId);

    String updateTruckType(Long truckTypeId, String typeName, Double len,
        Double width, Double height, Double carryingCapacity,
        Integer sequence, Boolean cangointotown, Long areaId);

    Page<Order> queryFreightOrder(Long companyId, String orderNo, String employName,
        String employPhone, String passengerName,
        String passengerPhone, String truckType, Integer status);

    List<TruckType> queryTruckTypes(Long companyId);

    String deleteTruckType(Long truckTypeId);

    Result<TruckType> createTruckType(TruckType truckType);

    Result<Order> cancelOrder(Order order, Driver driver, String cancelCause);

    Order findOne(Long id);

    void remark(Long id, String memo);

    void closeCuidan(Long orderId);

    Result<Order> callback(Long id, Driver driver, String cause);

    Result<Order> createOrder(Long passengerId, String passengerName,
        String passengerPhone, Long companyId, String companyName,
        Long truckTypeId, String truckTypeName, String channelName,
        Long startDate, String startAddress, Boolean flitting, Boolean receipt,
        Boolean receivedPay, Double payMount, Double startPrice,
        Double mileage, Integer runTime, Double mileagePrice,
        Double runTimePrice, Long couponId, Double couponMoney, Double budgetPay,
        String waypoint, String operator, Boolean fixedPrice, Double fixPriceMoney);

    Page<TruckType> truckTypeDate(Long companyId, String companyName);

    Page<Map<String, Object>> orderListData(String orderNumber,
        String clientPhone, String driverPhone, String companyName,
        String startTime, String endTime, String allorderType,
        String allErrrandOrderType, Boolean treatment, String startFinishTime, String endFinishTime,
        Integer page, Integer rows) throws ParseException;

    List<Map<String, Object>> orderListDataExport(String orderNumber,
        String clientPhone, String driverPhone, String companyName,
        String startTime, String endTime, String allorderType,
        String allErrrandOrderType, Boolean treatment, String startFinishTime, String endFinishTime)
        throws ParseException;

    List<Order> selectCuidan();

    Result<Order> paidan(Driver driver, Order order);

    Long countActivedOrdersByDriver(Long employId);

    Page<Truck> queryByParamsCars(String companyNames, String truckTypes,
        String carNumber, String driverName, String allstatus);

    Truck createCar(Long companyId, String companyName, String carNumber,
        Long truckTypeId, String name, String truckTypeName, Long employId, String employName);

    Truck findTruck(Long id);

    Map<String, Object> updateTruck(Long id, Long companyId, String companyName,
        String name, String carNumber, Long truckTypeId,
        String truckTypeName, Integer status, Long employId,
        String employName);


    List<Truck> findTruckByNumber(String carNumber);

    int deleteTruck(Long id);

    ChartYear dataForYear(Integer year, Long companyId);

    ChartMonth freightDataForMonth(Integer year, Integer month, Long companyId);

    ChartDay freightDataForDay(Integer year, Integer month, Integer day,
        Long companyId);

    PageVo<DriverOrderVo> freightIntroduce(Long companyId, Date start, Date end);

    List<TableOrderMonthVo> tableOrderMonth(Integer year, Long companyId);

    PageVo<OrderFromSourceVo> orderFromSource(Date start, Date end,
        Long companyId);

    List<Order> findMonthOrder(Integer year, Integer month);

    PageVo<CompanyOrderVo> companyOrder(Date start, Date end);


    PageVo<MemberOrderVo> freightMemberOrder(Date start, Date end,
        Long companyId, Long gradeId, Integer type);

    void acceptInfoFee(Driver driver, Order order);

    List<Order> queryByEmployId(Long employId, String status);

    PageVo<DriverOrderDetailVo> driverOrderDetail(Long driverId, Date start,
        Date end);

    List<com.ybkj.daijia.server.freight.Order> listNewOrders();

    List<com.ybkj.daijia.server.freight.Order> findActivedOrdersByDriver(
        Long id);

    Result<Order> confirmTask(Order order, String jsonLocs);

    Result<Order> confirmTaskV4(Order order, Driver driver);

    Result<Order> completeTaskNewV3(Order order, Passenger passenger, Driver driver, String string,
        String payType);

    Result<PayRecordOrder> createPayRecordOrder(PayRecordOrder payRecordOrder);

    Result<PayRecordOrder> payRecordOrderTreatment(PayRecordOrder payRecordOrder);

    PayRecordOrder findOnePayRecordOrder(Long id);

    Long countFinishedByPassengerAndFinishTime(Long passengerId, String orderFromSources,
        Date startDate, Date endDate);

    OrderOrbit findOrbitByOrderId(Long id);

    List<Truck> findTruckByTruckTypeId(Long truckTypeId);

    List<Order> findByStatus(Integer orderStatusPaidan);

    void revoke(Order order, String string);

    long countActiveByPassenger(Long passengerId);

    Page<Order> findByDriverAndFinishTime(Long employId, Date begin, Date end, Integer page,
        Integer limit);

    Map<String, Object> findRate(Long driverid, Integer page, Integer limit);

    Rate findRateOne(Long id);

    void deleteRateOne(Long id);

    List<Order> findOrderFinishedBycompanyId(Long companyId, Date start, Date end);

    long countNotPayByPassenger(Long passengerId);

    //满足金额大于lowestMoney的完成订单
    List<Order> findReward(Long driverId, BigDecimal lowestMoney, Date start, Date end);

    Result<TruckType> newCreateTruckType(TruckType truckType);

    String newUpdateTruckType(Long truckTypeId, String typeName, Double len, Double width,
        Double height, Double carryingCapacity, Integer sequence, Boolean cangointotown,
        String img);

    Result<TruckType> subscribeTruckType(TruckTypeCompany ttc);

    Page<TruckTypeCompany> queryTruckTypeCompany(Long truckTypeId, Long companyId,
        String companyName);

    Map<String, Object> updateTruckTypeCompany(Long id, Long areaId);

    Map<String, Object> deleteTruckTypeCompany(Long truckTypeCompanyId);

    Result<Order> createMore(Order order, String waypoint);

    TruckType findTruckByTruckTypeIdAndCompanyId(Long truckTypeId, Long companyId);


    PageVo<DriverOrderDetailVo> driverOrderDetailCount(Long driverId, Date start, Date end);

    Result<Order> updateRealMoney(Order order, BigDecimal couponMoney, BigDecimal cashMoney,
        BigDecimal signMoney, BigDecimal balanceMoney, BigDecimal alipayMoney,
        BigDecimal weixinMoney, BigDecimal driverMoney, BigDecimal memberMoney, BigDecimal wxMoney,
        String content);

    Result<Order> autoCallback(Order order, Driver driver);

    Long getCreateOrderNumber(Long passengerId, String appKey);


}
